package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper {
    /**
     * 添加班级
     *
     * @param clazz
     */
    @Insert("insert into clazz (name, room, begin_date, end_date, master_id, subject, create_time, update_time)" +
            " values(#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void insertClazz(Clazz clazz);

    /**
     * 查询全部班级
     *
     * @return
     */
    @Select("select * from clazz")
    List<Clazz> selectClazzs();

    /**
     * 分页查询班级
     *
     * @param page
     * @return
     */
    List<Clazz> selectClazzsPage(ClazzQueryParam page);

    /**
     * 根据id查询班级
     *
     * @param id
     * @return
     */
    @Select("select * from clazz where id = #{id}")
    Clazz selectClazzById(Integer id);

    /**
     * 修改班级信息
     *
     * @param clazz
     */
    void updateClazzById(Clazz clazz);

    /**
     * 删除班级
     *
     * @param id
     */
    @Delete("delete from clazz where id = #{id}")
    void deleteClazzById(Integer id);
}
